<link rel="stylesheet" href="../assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="../assets/css/scrollbar.css">
<form method="POST" class="form-horizontal">
    <div class="form-group">
        <label for="name">商品名称</label>
        <input name="name" required type="text" value="红米note7-pro" class="form-control" id="name" placeholder="商品名称">
    </div>
    <div class="form-group">
        <label for="cover">商品封面</label>
        <!-- <input required type="file" class="form-control" id="cover"> -->
        <input name="cover" type="text" class="form-control"
            value="http://dummyimage.com/200x200/90E358/FFF.png&text=红米note7-pro" id="cover" placeholder="商品封面" />
    </div>
    <div class="form-group">
        <label for="price">零售价格</label>
        <input name="price" required type="number" value="999" class="form-control" id="price" placeholder="商品名称">
    </div>
    <div class="form-group">
        <label for="market-price">市场价格</label>
        <input name="market_price" required type="number" value="1999" class="form-control" id="market-price"
            placeholder="商品名称">
    </div>
    <div class="form-group">
        <label for="sales-volume">累计销量</label>

        <select required name="sales_volume" id="sales-volume" class="form-control">
            <option value="999">999</option>
            <option value="999">9999</option>
            <option value="999">99999</option>
            <option value="999">999999</option>
        </select>

    </div>

    <div class="form-group">
        <label for="description">商品描述</label>
        <input name="description" required type="text" value="默认商品描述" class="form-control" id="description"
            placeholder="商品描述">
    </div>
    <div class="form-group">
        <label for="brand">品牌</label>
        <select name="brand" required id="brand" class="form-control">
            <!-- <option value="">-- 请选择 --</option> -->
            <option value="苹果">苹果</option>
            <option value="三星">三星</option>
            <option value="华为">华为</option>
            <option value="小米">小米</option>
            <option value="格力">格力</option>
            <option value="锤子">锤子</option>
            <option value="联想">联想</option>
            <option value="OPPO">OPPO</option>
            <option value="VIVO">VIVO</option>

        </select>
    </div>
    <div class="form-group">
        <label for="category">分类</label>
        <select name="category" required id="category" class="form-control">
            <!-- <option value="">-- 请选择 --</option> -->
            <option value="智能手机">智能手机</option>
            <option value="笔记本">笔记本</option>
            <option value="智能设备">智能设备</option>
            <option value="数码家电">数码家电</option>
            <option value="生活用品">生活用品</option>
            <option value="生鲜水果">生鲜水果</option>
            <option value="母婴用品">母婴用品</option>
            <option value="汽车用品">汽车用品</option>
            <option value="美妆用品">美妆用品</option>
        </select>
    </div>
    <div class="form-group">
        <label for="introduce">商品详情</label>
        <script id="introduce" type="text/plain" style="width:100%;height:300px;"></script>
        <!-- <textarea id="introduce" name="introduce" required class="form-control" cols="30" rows="10" placeholder="商品详情">如张安但热织研转价北院局备价适声。飞而经什个外器存起气战只电最自月战。机确题必由从科得放格化太。情易线分活至和飞型回物对北。题交况口治十几传确压文争传体片适图。且相切发受我即做如引力二联置较界备强。办命影北规第志劳安接者因求志回。还却十用国型府水低交就两理一。断派达程五别统有话第新非件管。复千保确接科器石素集和内往毛机只体。</textarea> -->
    </div>
    <button type="submit" class="btn btn-lg btn-block btn-primary">立即提交</button>
</form>
<script src="../assets/js/jquery.js"></script>
<script src="../assets/bootstrap/js/bootstrap.min.js"></script>
<!-- ueditor -->
<script type="text/javascript" charset="utf-8" src="../plugins/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="../plugins/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="../plugins/ueditor/lang/zh-cn/zh-cn.js"></script>
<!-- ueditor -->

<script>
    $(function () {
        // 实例化ueditor
        var ue = UE.getEditor('introduce');
        $("form").on('submit', function (e) {
            e.preventDefault();
            var postData = $("form").serialize();
            // var richText=ue.getContent();
            // console.log(postData);
            $.post('../apis/index.php?c=Product&a=add', postData, function (res) {
                console.log(res);
                if (res.errcode == 0) {
                    alert('添加成功');
                }
            }, 'json');
        })
    });
</script>